<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8"/>
  <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
  <title>首页</title>

  <!-- 1. 导入CSS的全局样式 -->
  <link href="css/bootstrap.min.css" rel="stylesheet">
  <!-- 2. jQuery导入，建议使用1.9以上的版本 -->
  <script src="js/jquery-3.2.1.min.js"></script>
  <!-- 3. 导入bootstrap的js文件 -->
  <script src="js/bootstrap.min.js"></script>
  <script type="text/javascript">
  </script>
  <style type="text/css">
   .carousel-inner img {
      width: 100%;
      height: 100%;
  }
  </style>


</head>
<body>
<div class="jumbotron" style="height:175px;">
  <h1>${user.username},欢迎您</h1> <p>晚上好！</p>
 </div>

<!--  图片轮播  -->
<!--     <div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> -->
<!--         轮播图片的提示点 -->
<!--         <ol class="carousel-indicators"> -->
<!--             <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li> -->
<!--             <li data-target="#carousel-example-generic" data-slide-to="1" ></li> -->
<!--             <li data-target="#carousel-example-generic" data-slide-to="2" ></li> -->
<!--         </ol> -->
<!--         轮播图片 -->
<!--         <div class="carousel-inner" role="listbox"> -->
<!--             <div class="item active"> -->
<!--                 <img src="./imges/1.jpg" alt="1"> -->
<!--                 <div class="carousel-caption"> -->
<!-- <!--                     <h4>教学天地</h4>可以设置浮动在图片上面的文字  -->
<!-- <!--                     <p>这个大学是华南地区唯一一所医药大学</p>  -->
<!--                 </div> -->
<!--             </div> -->
<!--             <div class="item "> -->
<!--                 <img src="./imges/1.jpg" alt="2"> -->
<!--                 <div class="carousel-caption"></div> -->
<!--             </div> -->
<!--             <div class="item "> -->
<!--                 <img src="./imges/1.jpg" alt="3"> -->
<!--                 <div class="carousel-caption"></div> -->
<!--             </div> -->
<!--         </div> -->
<!--         左右滑动图标 -->
<!--         <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev"> -->
<!--             <span class="glyphicon glyphicon-chevron-left" ></span> -->
<!--             <span class="sr-only">Previous</span> -->
<!--         </a> -->
<!--         <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next"> -->
<!--             <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> -->
<!--             <span class="sr-only">Next</span> -->
<!--         </a> -->
<!--     </div> -->

<!-- 导航条固定 -->
<nav class="navbar navbar-default navbar-fixed-top" style="width:100%;">
  <div class="container-fluid ">
<!--     Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header ">
      <a class="navbar-brand" href="#" style="width:140px;">Brand</a>
    </div>
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav navbar-left" >
        <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
        <li><a href="${pageContext.request.contextPath}/carshopindexServlet?userid=${user.userid}" >我的购物车</a></li>
         <li><a href="#">我的订单</a></li>
          <li><a href="#">Link</a></li>
           <li><a href="#">Link</a></li>
             <li><a href="#">Link</a></li>
      </ul>
      <ul class="nav navbar-nav  navbar-right" >  
        <li><a href="#">${user.username}</a></li>
        <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
          <li><a href="#"></a></li>
           <li><a href="#">我的信息</a></li>
             <li><a href="#">我的收藏</a></li>
      </ul>
    </div>
  </div>
</nav>


<div style="width:90% ;height:100px; background:reds; margin:auto ;text-align:center" >
	<div class="page-header">
 		 <h1>今天又是懒懒的一天! <small>快来康康今天的推荐吧</small></h1>
	</div>
</div>

<!-- 商品显示页面 -->
<div  style="width:1050px ;height:400px; margin:auto" >
   <c:forEach items="${pb.list}" var="shop" varStatus="s">
	<div class="col-xs-6 col-md-3">
		    <a href="#" class="thumbnail">
		      <img src="./${shop.url}" alt="商品图片">
		    </a>
		     <div style="float:right">
		     	<p><a href="${pageContext.request.contextPath}/carshops?shopid=${shop.shopid}" class="btn btn-primary" role="button">加入购物车</a></p>
		     </div>
		       <div class="caption">
		        <h3>RMB:${shop.price}</h3>
		        <p>${shop.shopname}</p>
		      </div>
	</div>
 </c:forEach>
</div>
<!-- 页码翻页功能实现第一个div用来占位符 -->
	<div style="width:1200px ;height:10px;"></div>

	<div style="width:800px ;height:70px; margin:auto; text-align:center">
		<div style="margin:auto; text-align:center;">
		  <nav aria-label="Page navigation "  > 
            <ul class="pagination  pagination-lg" style="margin:auto;">
                <c:if test="${pb.currentPage == 1}">
                    <li class="disabled">
                      <a href="${pageContext.request.contextPath}/shopByPageServlet?currentPage=${pb.currentPage}&rows=12" aria-label="Previous">
                        <span aria-hidden="true">&laquo;</span>
                     </a>
              	    </li>
                </c:if>
                <c:if test="${pb.currentPage != 1}">
                    <li>
                   	  <a href="${pageContext.request.contextPath}/shopByPageServlet?currentPage=${pb.currentPage - 1}&rows=12" aria-label="Previous">
                        <span aria-hidden="true">&laquo;</span>
                      </a>
                    </li>
                </c:if>
                <c:forEach begin="1" end="${pb.totalPage}" var="i" >
                    <c:if test="${pb.currentPage == i}">
                        <li class="active"><a href="${pageContext.request.contextPath}/shopByPageServlet?currentPage=${i}&rows=12">${i}</a></li>
                    </c:if>
                    <c:if test="${pb.currentPage != i}">
                        <li><a href="${pageContext.request.contextPath}/shopByPageServlet?currentPage=${i}&rows=12">${i}</a></li>
                    </c:if>
                </c:forEach>
				<c:if test="${pb.currentPage==pb.totalPage}">
                    <li class="disabled">
                      <a href="${pageContext.request.contextPath}/shopByPageServlet?currentPage=${pb.currentPage}&rows=12" aria-label="Next">
                        <span aria-hidden="true">&raquo;</span>
                     </a>
              	  </li>
                </c:if>
                <c:if test="${pb.currentPage!=pb.totalPage}">
                    <li>
                   	  <a href="${pageContext.request.contextPath}/shopByPageServlet?currentPage=${pb.currentPage + 1}&rows=12" aria-label="Next">
                   	     <span aria-hidden="true">&raquo;</span>
                	  </a>
              	    </li>
                </c:if>
                 <span style="font-size: 25px;margin-left: 5px;">
                                                 共${pb.totalCount}条记录，共${pb.totalPage}页
                </span>
            </ul>
           </nav>
		</div>
        
    </div>
 
</body>
</html>